﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RearLivestock.Common.Domains.Enum;

namespace RearLivestock.Beginning.Api.Controllers
{
    /// <summary>
    /// 枚举类型控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class EnumsController : ControllerBase
    {
        /// <summary>
        /// 获取出生状态
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetBirthStatus")]
        public List<object> GetBirthStatus()
        {
            List<object> result = new List<object>();
            var values = Enum.GetValues<BirthStatusEnums>();
            foreach (var item in values)
            {
                result.Add(new { Id = (int)item, Name = item.ToString() });
            }
            return result;
        }

        /// <summary>
        /// 获取销售等级
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetSaleslevel")]
        public List<object> GetSaleslevel()
        {
            List<object> result = new List<object>();
            var values = Enum.GetValues<SaleslevelEnums>();
            foreach (var item in values)
            {
                result.Add(new { Id = (int)item, Name = item.ToString() });
            }
            return result;
        }

        /// <summary>
        /// 获取繁殖状态
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetReproductivestatus")]
        public List<object> GetReproductivestatus()
        {
            List<object> result = new List<object>();
            var values = Enum.GetValues<ReproductivestatusEnums>();
            foreach (var item in values)
            {
                result.Add(new { Id = (int)item, Name = item.ToString() });
            }
            return result;
        }

        /// <summary>
        /// 获取生产等级
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetProductiongrade")]
        public List<object> GetProductiongrade()
        {
            List<object> result = new List<object>();
            var values = Enum.GetValues<ProductiongradeEnums>();
            foreach (var item in values)
            {
                result.Add(new { Id = (int)item, Name = item.ToString() });
            }
            return result;
        }

        /// <summary>
        /// 获取在场状态
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetPresentstatus")]
        public List<object> GetPresentstatus()
        {
            List<object> result = new List<object>();
            var values = Enum.GetValues<PresentstatusEnums>();
            foreach (var item in values)
            {
                result.Add(new { Id = (int)item, Name = item.ToString() });
            }
            return result;
        }

        /// <summary>
        /// 获取基因等级
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetGeneticlevel")]
        public List<object> GetGeneticlevel()
        {
            List<object> result = new List<object>();
            var values = Enum.GetValues<GeneticlevelEnums>();
            foreach (var item in values)
            {
                result.Add(new { Id = (int)item, Name = item.ToString() });
            }
            return result;
        }

        /// <summary>
        /// 获取种母发情类型
        /// </summary>
        /// <returns></returns>
        [HttpGet("GetEstrustype")]
        public List<object> GetEstrustype()
        {
            List<object> result = new List<object>();
            var values = Enum.GetValues<EstrustypeEnums>();
            foreach (var item in values)
            {
                result.Add(new { Id = (int)item, Name = item.ToString() });
            }
            return result;
        }
    }
}
